<template>
  <div class="charts-section">
    <h2 class="section-title">API测试分析</h2>
    <div class="charts-grid">
      <div class="chart-card">
        <div class="chart-header">
          <h3 class="chart-title">API测试覆盖率</h3>
          <span class="chart-value">{{ apiStats.coverage }}%</span>
        </div>
        <div class="chart-container">
          <CoverageChart :percentage="apiStats.coverage" />
        </div>
      </div>
      <div class="chart-card">
        <div class="chart-header">
          <h3 class="chart-title">API测试通过率</h3>
          <span class="chart-value">{{ apiStats.passRate }}%</span>
        </div>
        <div class="chart-container">
          <PassRateChart :percentage="apiStats.passRate" />
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import { reactive } from 'vue'
import CoverageChart from './CoverageChart.vue'
import PassRateChart from './PassRateChart.vue'

export default {
  name: 'ChartsSection',
  components: {
    CoverageChart,
    PassRateChart
  },
  setup() {
    const apiStats = reactive({
      coverage: 85,
      passRate: 92
    })

    return {
      apiStats
    }
  }
}
</script>

<style scoped>
.charts-section {
  margin-bottom: 25px;
}

.section-title {
  font-size: 16px;
  font-weight: 600;
  color: #1e293b;
  margin-bottom: 15px;
}

.charts-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
}

.chart-card {
  background: white;
  padding: 20px;
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.chart-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
}

.chart-title {
  font-size: 14px;
  font-weight: 600;
  color: #374151;
}

.chart-value {
  font-size: 18px;
  font-weight: 700;
  color: #1e293b;
}

.chart-container {
  height: 120px;
}

@media (max-width: 768px) {
  .charts-grid {
    grid-template-columns: 1fr;
  }
}
</style>